import React from 'react';
import {useParams,useSearchParams,useLocation} from "react-router-dom";

export default function Detail() {
    // params传参
    // const {id,title,content} =useParams();

    // search传参
    // const [searchParams,setSearchParams]=useSearchParams();
    // const id=searchParams.get("id");
    // const title=searchParams.get("title");
    // const content=searchParams.get("content");

    // state传参
    const {state:{id,title,content}}=useLocation();
    return (
        <ul>
            {/* <button onClick={()=>{return setSearchParams("id=005&title=消息5&content=我是你爹")}}>点我改变search传参</button> */}
            <li>消息id：{id}</li>
            <li>消息标题：{title}</li>
            <li>消息内容：{content}</li>
        </ul>
    )
}
